boot allocator: use arch helper for virt_to_mfn on DIRECTMAP_VIRT region
authorVijaya Kumar K <Vijaya.Kumar@cavium.com>
Fri, 7 Apr 2017 10:04:14 +0000 (12:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 Apr 2017 10:05:02 +0000 (12:05 +0200)
commitc6fdc9696a6a6eac59bf9c81121d1f1cd5b88dcd
treea927e9e6132fa5e928b40352a7f4af5e98275097
parent9f5390441a6e55990e6ae78e51fd800e55fb9637
boot allocator: use arch helper for virt_to_mfn on DIRECTMAP_VIRT region

On ARM platforms with NUMA, while initializing second memory node,
panic is triggered from init_node_heap() when virt_to_mfn()
is called for DIRECTMAP_VIRT region address because DIRECTMAP_VIRT
region is not mapped to any virtual address.

The check virt_to_mfn() here is used to know whether the max MFN is
part of the direct mapping. The max MFN is found by calling virt_to_mfn
on end address of DIRECTMAP_VIRT region, which is DIRECTMAP_VIRT_END.

On ARM64, all RAM is currently direct mapped in Xen and virt_to_mfn
uses the hardware for address translation. So if the virtual address
is not mapped translation fault is raised.

In this patch, instead of calling virt_to_mfn(), arch helper
arch_mfn_in_directmap() is introduced.

On ARM64 this arch helper will return true, because currently all RAM
is direct mapped in Xen.
On ARM32, only a limited amount of RAM, called xenheap, is always mapped
and DIRECTMAP_VIRT region is not mapped. Hence return false.
For x86 this helper does virt_to_mfn.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
xen/common/page_alloc.c
xen/include/asm-arm/arm32/mm.h [new file with mode: 0644]
xen/include/asm-arm/arm64/mm.h [new file with mode: 0644]
xen/include/asm-arm/mm.h
xen/include/asm-x86/mm.h